#include "epollServer.hpp"
#include "Log.hpp"
#include <memory>

using namespace std;
using namespace epollserver;

static void Usage(const string& proc)
{
    std::cerr << "Usage:\n\t" << proc << " port\n\n";
}

string echo(const string& message)
{
    return " I am epollserver, " + message;
}

// ./epollServer 8080
int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERR);
    }

    uint16_t port = atoi(argv[1]);
    unique_ptr<epollServer> esvr(new epollServer(echo,port));

    esvr->initServer();
    esvr->start();

    return 0;
}